<?php

namespace App\Api\Http\ApiControllers;

use App\Application\UserService;
use Illuminate\Http\Request;

class PublisherController extends Controller
{
    /**
     * @var UserService
     */
    protected $user_service;

    public function __construct(UserService $user_service)
    {
        $this->user_service = $user_service;
    }

    public function active(Request $request)
    {
        $invite_code = $request->request->get('code');
        $user_id = access()->id();
        $this->user_service->becomePublisher($user_id, $invite_code);

        return response()->json('', 204);
    }
}
